
<?php
$this->widget('application.extensions.fancybox.EFancyBox', array(
        'target'=>'a[rel=fancybox]',
        'config'=>array(),
    )
);
//Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/modal/dxtmodal.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/modal/modal.css');
/**
 * @var $gclass GuitarClass
 */

foreach ($guitarclass as $gclass):?>
<div class="item">
    <?php echo ' - ' . CHtml::link($gclass->title, $this->createUrl('viewclass', array('id' => $gclass->id, 'title' => Yii::app()->func->safeTitle($gclass->title),'tname'=>Yii::app()->func->safeTitle($gclass->training->name)))); ?>
    <br/>
    Thời gian học: <span style="color: red;font-weight: bold;"><?php echo date('d/m/Y', $gclass->start_time); ?></span>
    đến <span style="color: red;font-weight: bold;"><?php echo date('d/m/Y', $gclass->end_time); ?></span>
    <?php
    if ($gclass->end_time >= time()) {
        if (!$gclass->checkRegistered()) {
            echo ' &rArr; '.CHtml::link('Đăng ký',$this->createUrl('register', array('cid' => $gclass->id,'title'=>Yii::app()->func->safeTitle($gclass->title))),array('class'=>'reg'));
        }
        else {
            echo ' &rArr; Bạn không được đăng ký';
        }
    } else {
        echo ' &rArr; Đã kết thúc';
    }
    ?>
    <div id="regDialog"></div>
</div>
<?php endforeach ?>
<script type="text/javascript">
    $(function(){
        $('.reg').dxtmodal({width:280,height:520,title:'Đăng ký học',showMask:true});
    });
</script>